<!doctype html> 
<html> <!-- no session start - it is included everywhere -->
<head>

	<meta charset="UTF-8">
 	<link rel="shortcut icon" type="image/ico" href="img/icon.ico" />
	<link href="css/bootstrap.css" rel="stylesheet">
	<script type="text/javascript" src="js/jquery-1.10.1.js"></script>
	<script type="text/javascript" src="js/jquery-1.2.6.min.js"></script>
	<script type="text/javascript" src="js/buttonLogin.js"></script> 
    <script src="js/jquery.js"></script>
    <script src="js/bootstrap.js"></script>
	<title>Cinema Management System</title>
	
	 <script>
	</script>

	<style type="text/css">

	body{
    	background-image:url('http://us.123rf.com/400wm/400/400/yupiramos/yupiramos1112/yupiramos111200120/11549295-film-tape-with-film-stripe-over-white-background-vector.jpg');
   	margin-left: 10%;
	margin-right: 10%;
    }
    #saloon {
    	position: relative;
	  margin-left: 20%;
	   margin-right: 20%;
	  }
	#search_form {
	  position:relative;
	  margin-top: 5%;
	  }
	#login_form {
	  position:relative;
	  top:-150px;
	  margin-top: 5%;
	  margin-left:80%;
	  }

	div.movie
	{
	  color:#FFFFFF;
	  background-color: #000000;
	  margin: 2px;
	  border: 1px solid #0000ff;
	  height: 400px;
	  width: 220px;
	  float: left;
	  text-align: center;
	} 
  </style>
</head>

<body>
<div class="menu">
	<div class="navbar navbar-inverse navbar-fixed-top">
    	<div class="navbar-inner">
    		<div class="container">
      <!-- Navigation panel -->
		 		<ul class="nav">
					<li><a href="projections.php">Programme</a></li>
					<li><a href="index.php">Main page</a></li>
					<li class="dropdown" id="menu1">
               		<a class="dropdown-toggle" data-toggle="dropdown" href="#menu1">
                 		Cinemas
                  	<b class="caret"></b>
               		</a>
                		<ul class="dropdown-menu">
		                	<?php
		                	$quercount=" select count(*) as cnt FROM cinemas";
							$rescount = db_query($quercount);
							$rll= db_get_row($rescount);
							$cincount=$rll["cnt"];

                			for($i=1;$i<=$cincount;$i++){
								$query2 = "SELECT * FROM cinemas WHERE  id=$i LIMIT 1"; //LIMIT 1 is for optimization
								$result2 = db_query($query2);
								$row2= db_get_row($result2);
								echo "<li> <a href=\"projections.php?cinema=".$row2["id"]."\">".$row2["name"]."</a></li>";
					 		}
                			?>
                		</ul>
            		</li>
					<?php 
					if (isset($_SESSION["uisadmin"]) && $_SESSION['uisadmin'] == 1){ //Only for the admin user 
					?>
						<li><a href="admin.php">Administration</a></li>
					<?php
					}
					?>	
					<?php 
					if (isset($_SESSION["uisadmin"]) && $_SESSION['uisadmin'] >-1){//if the user is logged in 
					?>
						<li><a href="index.php?logout=1">Logout</a></li>
					<?php
					}
					else{
					?>	
					<li><a href="register.php">Register</a></li>
					<?php     
					}
					?>     
				</ul>
			</div>
		</div>
	</div>
</div>
<div id="search_form" >         
	<?php
	include "search_form.php";
	?>	
</div>
	
